/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ctrl.sys;

import java.io.ObjectOutputStream;
import java.util.ArrayList;

/**
 *
 * @author Willy
 */
public class Client {
    int idPlace;
    ObjectOutputStream Sock_Client;
    // constructeur
    public Client(int id)
    {
        this.idPlace=id;
    }

    public Client(int idPlace, ObjectOutputStream Sock_Client) {
        this.idPlace = idPlace;
        this.Sock_Client = Sock_Client;
    }

    public ObjectOutputStream getSock_Client() {
        return Sock_Client;
    }


    public void setSock_Client(ObjectOutputStream Sock_Client) {
        this.Sock_Client = Sock_Client;
    }

    public int getIdPlace() {
        return idPlace;
    }

    public void setIdPlace(int idPlace) {
        this.idPlace = idPlace;
    }

    @Override
    public boolean equals(Object obj) {

        if(obj instanceof Client)
        return ((Client)obj).getIdPlace()==this.getIdPlace();
        return false;
    }

    @Override
    public String toString() {
        return "C- "+getIdPlace();
    }

    public static ObjectOutputStream getClient(ArrayList<Client> lst, ObjectOutputStream ob)
    {
        for(int i=0;i<lst.size();i++)
        {
            if(lst.get(i).getSock_Client().equals(ob)) return ob;
        }
        return null;
    }

    // main
    public static void main(String[] args)
    {

    }

}
